from datetime import datetime

from pydantic import Field
from typing import Optional, Annotated, List

from ..base import BaseApiListOut, BaseSchema, BaseApiOut


class NodeBase(BaseSchema):
    name: Optional[str] = Field(None, description='节点名称')
    code: Optional[str] = Field(None, description='节点编码')
    emoji: Optional[str] = Field(None, description='节点图标')
    suffix_domain: Optional[str] = Field(None, description='接口后缀域名')
    remarks: Optional[str] = Field(None, description='备注')


class Node(NodeBase):
    id: Optional[int] = Field(0, description='自增ID')

    created_at: Annotated[Optional[datetime], Optional[str]] = None
    updated_at: Annotated[Optional[datetime], Optional[str]] = None


class NodeOut(BaseApiOut):
    data: Annotated[Node, None] = None


class NodeListOut(BaseApiListOut):
    data: Annotated[List[Node], None] = None
